﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _plants_vs_zombies
{
    class Pea
    {
        /// <summary>
        /// 子弹的rectangle
        /// </summary>
        public Rectangle Rectangle { get; set; }
        
        /// <summary>
        /// 子弹的飞行速度
        /// </summary>
        private int Speed;

        /// <summary>
        /// 初始化Pea
        /// </summary>
        /// <param name="rec"></param>
        public Pea(Rectangle rec)
        {
            Rectangle = rec;
            //子弹的飞行速度
            Speed = 18;
        }

        /// <summary>
        /// 绘制pea
        /// </summary>
        /// <param name="g"></param>
        public void Draw(Graphics g)
        {
            g.DrawImage(Properties.Resources.豌豆, Rectangle);
        }

        /// <summary>
        /// 豌豆的移动函数
        /// </summary>
        public void Move()
        {
            this.Rectangle = new Rectangle(Rectangle.X + Speed, Rectangle.Y, Rectangle.Width, Rectangle.Height);
        }
    }
}
